home *** CD-ROM | disk | FTP | other *** search
/ L' Effet Pommier 3 / L'Effet Pommier - Volume 03.iso / Programmation / Alpha ƒ / Help / Diff Help < prev    next >
Text File  |  1994-09-04  |  9KB  |  278 lines

  1.  
  2.  
  3.  
  4. DIFF(1)                  USER COMMANDS                    DIFF(1)
  5.  
  6.  
  7.  
  8. NAME
  9.      diff - display line-by-line  differences  between  pairs  of
  10.      text files
  11.  
  12. SYNOPSIS
  13.      diff [ -bitw ] [ -c [ # ] | -e | -f | -n | -h  ]   filename1
  14.      filename2
  15.      diff [ -bitw ] [ -Dstring ]  filename1 filename2
  16.      diff [ -bitw ] [ -c [ # ] | -e | -f | -n | -h ] [ -l ] [  -r
  17.      ] [ -s ] [ -Sname ]  directory1 directory2
  18.  
  19. DESCRIPTION
  20.      diff is a differential file comparator.  When run on regular
  21.      files,  and  when  comparing  text  files that differ during
  22.      directory comparison  (see  the  notes  below  on  comparing
  23.      directories),  diff  tells what lines must be changed in the
  24.      files to bring them into agreement.   Except  in  rare  cir-
  25.      cumstances,  diff finds a smallest sufficient set of differ-
  26.      ences.  If neither filename1 nor filename2 is  a  directory,
  27.      either may be given as `-', in which case the standard input
  28.      is used.  If filename1 is a directory, a file in that direc-
  29.      tory whose filename is the same as the filename of filename2
  30.      is used (and vice versa).
  31.  
  32.      There are several options for  output  format;  the  default
  33.      output format contains lines of these forms:
  34.  
  35.           n1 a n3,n4
  36.           n1,n2 d n3
  37.           n1,n2 c n3,n4
  38.  
  39.      These lines resemble ed(1)  commands  to  convert  filename1
  40.      into  filename2.   The  numbers after the letters pertain to
  41.      filename2.  In fact, by exchanging a for d and reading back-
  42.      ward one may ascertain equally how to convert filename2 into
  43.      filename1.  As in ed(1), identical pairs, where n1 =  n2  or
  44.      n3 = n4, are abbreviated as a single number.
  45.  
  46.      Following each of these lines come all the  lines  that  are
  47.      affected  in  the  first  file  flagged by `<', then all the
  48.      lines that are affected in the second file flagged by `>'.
  49.  
  50.      If both arguments are directories, diff sorts  the  contents
  51.      of  the  directories by name, and then runs the regular file
  52.      diff program as described above on text files which are dif-
  53.      ferent.   Binary  files which differ, common subdirectories,
  54.      and files which appear in only one directory are listed.
  55.  
  56. OPTIONS
  57.      -b   Ignore trailing blanks (SPACE and TAB  characters)  and
  58.           treat all other strings of blanks as equivalent.
  59.  
  60.  
  61.  
  62.  
  63. Sun Release 4.1    Last change: 2 October 1989                  1
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. DIFF(1)                  USER COMMANDS                    DIFF(1)
  71.  
  72.  
  73.  
  74.      -i   Ignore the case of letters; for example, `A' will  com-
  75.           pare equal to `a'.
  76.  
  77.      -t   Expand TAB characters in output lines.   Normal  or  -c
  78.           output  adds  character(s)  to  the  front of each line
  79.           which may alter the indentation of the original  source
  80.           lines  and  make the output listing difficult to inter-
  81.           pret.  This option will preserve the original  source's
  82.           indentation.
  83.  
  84.      -w   Ignore all blanks (SPACE and TAB characters); for exam-
  85.           ple, `if ( a == b )' will compare equal to `if(a==b)'.
  86.  
  87.      The following four options are mutually exclusive:
  88.  
  89.      -c[#]
  90.           Produce a listing of differences with lines of context.
  91.           The default is to present 3 lines of context and may be
  92.           changed, (to 10, for example), by -c10.   With  -c  the
  93.           output format is modified slightly:  output begins with
  94.           identification of the files involved and their creation
  95.           dates,  then  each change is separated by a line with a
  96.           dozen *s.  The lines removed from filename1 are  marked
  97.           with  `-  ';  those added to filename2 are marked `+ '.
  98.           Lines which are changed from one file to the other  are
  99.           marked in both files with `! '.
  100.  
  101.           Changes which lie within <context> lines of each  other
  102.           are  grouped together on output.  This is a change from
  103.           the previous `diff -c' but the resulting output is usu-
  104.           ally much easier to interpret.
  105.  
  106.      -e   Produce a script of a, c, and d commands for the editor
  107.           ed, which will recreate filename2 from filename1.
  108.  
  109.           In connection with -e, the following shell program  may
  110.           help  maintain  multiple  versions  of a file.  Only an
  111.           ancestral file ($1) and a chain  of  version-to-version
  112.           ed scripts ($2,$3,...) made by diff need be on hand.  A
  113.           `latest version' appears on the standard output.
  114.  
  115.                (shift; cat $*; echo '1,$p') | ed - $1
  116.  
  117.           Extra commands are added to the output  when  comparing
  118.           directories  with -e, so that the result is a sh script
  119.           for converting text files which are common to  the  two
  120.           directories  from  their  state  in directory1 to their
  121.           state in directory2.
  122.  
  123.      -f   Produce a script similar to that of -e, not useful with
  124.           ed, which is in the opposite order.
  125.  
  126.      -n   Produce a script similar to that  of  -e,  but  in  the
  127.  
  128.  
  129.  
  130. Sun Release 4.1    Last change: 2 October 1989                  2
  131.  
  132.  
  133.  
  134.  
  135.  
  136. DIFF(1)                  USER COMMANDS                    DIFF(1)
  137.  
  138.  
  139.  
  140.           opposite  order  and  with  a count of changed lines on
  141.           each insert or delete command.
  142.  
  143.      -h   Do a  fast,  half-hearted  job.   It  works  only  when
  144.           changed  stretches  are  short  and well separated, but
  145.           does work on files of unlimited length.
  146.  
  147.      Options for the second form of diff are as follows:
  148.  
  149.      -Dstring
  150.           Create a merged version of filename1 and  filename2  on
  151.           the  standard  output,  with  C  preprocessor  controls
  152.           included so that a compilation of  the  result  without
  153.           defining  string  is equivalent to compiling filename1,
  154.           while defining string will yield filename2.
  155.  
  156.      Options when comparing directories are:
  157.  
  158.      -l   Long output  format;  each  text  file  diff  is  piped
  159.           through  pr(1V)  to  paginate it, other differences are
  160.           remembered and summarized after all text  file  differ-
  161.           ences are reported.
  162.  
  163.      -r   Apply diff recursively to common subdirectories encoun-
  164.           tered.
  165.  
  166.      -s   Report files which are the same,  which  are  otherwise
  167.           not mentioned.
  168.  
  169.      -Sname
  170.           Start a directory diff in the  middle,  beginning  with
  171.           file name.
  172.  
  173. ENVIRONMENT
  174.      The environment variables  LC_CTYPE,  LANG,  and  LC_default
  175.      control  the  character  classification throughout diff.  On
  176.      entry to diff, these environment variables  are  checked  in
  177.      the following order: LC_CTYPE, LANG, and LC_default.  When a
  178.      valid value is found, remaining  environment  variables  for
  179.      character  classification  are  ignored.  For example, a new
  180.      setting for LANG does not override the current valid charac-
  181.      ter  classification  rules  of  LC_CTYPE.   When none of the
  182.      values is valid, the shell character classification defaults
  183.      to the POSIX.1 "C" locale.
  184.  
  185. FILES
  186.      /tmp/d?????
  187.      /usr/lib/diffh      for -h
  188.  
  189. SEE ALSO
  190.      cc(1V), cmp(1), comm(1), cpp(1), diff3(1V),  ed(1),  pr(1V),
  191.      locale(5), iso_8859_1(7)
  192.  
  193.  
  194.  
  195. Sun Release 4.1    Last change: 2 October 1989                  3
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202. DIFF(1)                  USER COMMANDS                    DIFF(1)
  203.  
  204.  
  205.  
  206. DIAGNOSTICS
  207.      Exit status is 0 for no differences, 1 for some differences,
  208.      2 for trouble.
  209.  
  210.      Missing newline at end of fileX
  211.           Indicates that the last line of file X did not  have  a
  212.           NEWLINE.  If  the  lines  are  different,  they will be
  213.           flagged and output, although the output  will  seem  to
  214.           indicate they are the same.
  215.  
  216. BUGS
  217.      Editing scripts produced under the -e or -f option are naive
  218.      about creating lines consisting of a single `.'.
  219.  
  220.      When comparing directories with the -b, -w,  or  -i  options
  221.      specified,  diff first compares the files (as in cmp(1), and
  222.      then runs the regular diff algorithm if they are not  equal.
  223.      This  may  cause  a  small  amount of spurious output if the
  224.      files then turn out to be identical because the only differ-
  225.      ences are insignificant blank string or case differences.
  226.  
  227.      The -D option ignores existing preprocessor controls in  the
  228.      source  files,  and  can generate #ifdefs's with overlapping
  229.      scope.  The output should be checked by hand, or run through
  230.      `cc  -E'  (see  cc(1V))  and  then  diffed with the original
  231.      source files.  Discrepancies revealed  should  be  corrected
  232.      before compilation.
  233.  
  234.  
  235.  
  236.  
  237.  
  238.  
  239.  
  240.  
  241.  
  242.  
  243.  
  244.  
  245.  
  246.  
  247.  
  248.  
  249.  
  250.  
  251.  
  252.  
  253.  
  254.  
  255.  
  256.  
  257.  
  258.  
  259.  
  260.  
  261. Sun Release 4.1    Last change: 2 October 1989                  4
  262.  
  263.  
  264.  
  265. Enter Unix command line:
  266.  
  267. Usage: diff [-#] [-abBcdefhHilnNprstTuvw] [-C lines] [-F regexp] [-I regexp]
  268.        [-L label [-L label]] [-S file] [-D symbol] [+ignore-blank-lines]
  269.        [+context[=lines]] [+unified[=lines]] [+ifdef=symbol]
  270.        [+show-function-line=regexp]
  271.        [+speed-large-files] [+ignore-matching-lines=regexp] [+new-file]
  272.        [+initial-tab] [+starting-file=file] [+text] [+all-text] [+ascii]
  273.        [+minimal] [+ignore-space-change] [+ed] [+reversed-ed] [+ignore-case]
  274.        [+print] [+rcs] [+show-c-function] [+binary] [+brief] [+recursive]
  275.        [+report-identical-files] [+expand-tabs] [+ignore-all-space]
  276.        [+file-label=label [+file-label=label]] [+version] path1 path2
  277.  
  278.